<?php
header("content-type:text/html;charset=utf-8");
include "../public/config/config.php";
include "../public/include/funcs.php";
include "../public/include/money.class.php";
$obj=new money($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd,$cfg_dbname,$cfg_dbchar);
$link=conn($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd,$cfg_dbname,$cfg_dbchar);
$id=$_REQUEST['id'];
if($_POST['tname']){
	$arr_post=$_POST;
	unset($arr_post['id']);
	$arr_post['regtime_int'] = time();
	$re = add($link, "kehu_mo", $arr_post);
	if($re){
		echo "<script>";
		echo "alert('新增成功!');";
		echo "window.location.href='index.php?pid=".$id."';";
		echo "</script>";
	}else{
		echo "新增失败，请重新尝试！";
	}
}
$arr=select($link, "kehu_mo","id=$id");
$tname = $arr[0]['tname'];
$title_name=$arr[0]['tname']." -- 添加下级";

//$arr[0]['self_xf']=$obj->self_xf($id);
//$arr[0]['all_xf']=$obj->all_xf($id);
//$title_name=$arr[0]['tname']." -- 业绩详情";
//
//$tic=select($link, 'tic');
//$tic_xf=$tic[0]['tic_xf'];
//$tic_yi=$tic[0]['tic_yi'];
//$tic_er=$tic[0]['tic_er'];
//$tic_san=$tic[0]['tic_san'];
//
//$arr_id=$obj->arr_id($id);
//$arr_fx_money=$obj->arr_fx_money($arr_id);

echo "<pre>";
//print_r($arr);
//print_r($arr_post);
//print_r($arr_id);
//print_r($arr_fx_money);
echo "</pre>";
?>
<html>
	<head>
		<meta charset="UTF-8">
		<title><?php echo $title_name;?></title>
		<link rel="stylesheet" type="text/css" href="../public/css/main.css"/>
	</head>
	<body>
<div class="tab">
	<h3><?php echo $title_name;?></h3>
	
	<div class="frm w500">
		<form action="add_child.php" method="post">
			<input type="hidden" name="id" value="<?php echo $id;?>" />
			<table class="bfb0" border="1" cellspacing="0" cellpadding="0">
				<tr>
					<th colspan="2">填写信息</th>
				</tr>
				<tr>
					<td>姓名：</td>
					<td><input type="text" name="tname" value="" /></td>
				</tr>
				<tr>
					<td>账号：</td>
					<td><input type="text" name="uname" value="" /></td>
				</tr>
				<tr>
					<td>密码：</td>
					<td><input type="text" name="pwd" value="123456" /></td>
				</tr>
				<tr>
					<td>上级ID：</td>
					<td style="padding-top: 8px;"><input type="hidden" name="pid" value="<?php echo $id;?>" />
						<input type="text" disabled="disabled" value="<?php echo $id;?>" /></br>
						注：该会员添加后，上级是 ： <?php echo $tname;?>
					</td>
				</tr>
				
				<tr>
					<td colspan="2"><input class="sub" type="submit" value="提交"/></td>
				</tr>
			</table>
			
		</form>
	</div>
</div>
	</body>
</html>